Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ruff server searches for configuration in parent directories #11537

Merged
merged 3 commits into from
May 26, 2024

Conversation

snowsignal
Copy link
Contributor

Summary

Fixes #11506.

RuffSettingsIndex::new now searches for configuration files in parent directories.

Test Plan

I confirmed that the original test case described in the issue worked as expected.

@snowsignal snowsignal added server Related to the LSP server configuration Related to settings and configuration labels May 24, 2024
Copy link
Contributor

github-actions bot commented May 24, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@@ -88,7 +88,11 @@ impl RuffSettingsIndex {
.filter(|entry| entry.file_type().is_dir())
.map(DirEntry::into_path)
{
if let Some(pyproject) = settings_toml(&directory).ok().flatten() {
if let Some(pyproject) = find_settings_toml(&directory).ok().flatten() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should only do this once, for the root path.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no need to search in parent directories for every directory, since there's at most one pyproject above the root path.

@charliermarsh charliermarsh enabled auto-merge (squash) May 26, 2024 18:10
@charliermarsh charliermarsh merged commit 627d230 into main May 26, 2024
18 checks passed
@charliermarsh charliermarsh deleted the jane/server/fix-config-search branch May 26, 2024 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
configuration Related to settings and configuration server Related to the LSP server
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ruff server detects config file differently to ruff check
2 participants